Skip to content

feat(server): accept Standard Schemas in inputRequired.elicit#2369

Open
mattzcarey wants to merge 14 commits into
mainfrom
feat/elicitation-standard-schema
Open

feat(server): accept Standard Schemas in inputRequired.elicit#2369
mattzcarey wants to merge 14 commits into
mainfrom
feat/elicitation-standard-schema

Conversation

@mattzcarey

@mattzcarey mattzcarey commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Fixes #662.

Summary

  • allow inputRequired.elicit() to accept a Standard Schema/Zod object as requestedSchema
  • convert that schema to MCP's restricted form-elicitation JSON Schema
  • reuse the same schema with acceptedContent() to validate and type the response on handler re-entry
  • keep deprecated Server.elicitInput() and ctx.mcpReq.elicitInput() unchanged
  • reject converted validation constraints that MCP form elicitation cannot express instead of weakening them silently
  • preserve the raw JSON Schema input path unchanged

The modern write-once handler works on 2026-07-28 natively and on 2025-era connections through the existing legacy input_required shim.

Release

  • @modelcontextprotocol/core-internal: minor
  • @modelcontextprotocol/server: minor
  • no client package change

Verification

  • core-internal tests: 1,327 passed
  • server tests: 439 passed
  • modern input_required integration coverage
  • 2025 legacy-shim integration coverage
  • core-internal/server typechecks
  • examples typecheck
  • client/server builds
  • dist declaration smoke with skipLibCheck: false
  • snippet sync check
  • pre-push full build, typecheck, and lint

@mattzcarey mattzcarey requested a review from a team as a code owner June 25, 2026 12:46
@changeset-bot

changeset-bot Bot commented Jun 25, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 43d2b31

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@modelcontextprotocol/core-internal Minor
@modelcontextprotocol/server Minor
@modelcontextprotocol/express Major
@modelcontextprotocol/fastify Major
@modelcontextprotocol/hono Major
@modelcontextprotocol/node Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jun 25, 2026

Copy link
Copy Markdown

Open in StackBlitz

@modelcontextprotocol/client

npm i https://pkg.pr.new/@modelcontextprotocol/client@2369

@modelcontextprotocol/codemod

npm i https://pkg.pr.new/@modelcontextprotocol/codemod@2369

@modelcontextprotocol/core

npm i https://pkg.pr.new/@modelcontextprotocol/core@2369

@modelcontextprotocol/server

npm i https://pkg.pr.new/@modelcontextprotocol/server@2369

@modelcontextprotocol/server-legacy

npm i https://pkg.pr.new/@modelcontextprotocol/server-legacy@2369

@modelcontextprotocol/express

npm i https://pkg.pr.new/@modelcontextprotocol/express@2369

@modelcontextprotocol/fastify

npm i https://pkg.pr.new/@modelcontextprotocol/fastify@2369

@modelcontextprotocol/hono

npm i https://pkg.pr.new/@modelcontextprotocol/hono@2369

@modelcontextprotocol/node

npm i https://pkg.pr.new/@modelcontextprotocol/node@2369

commit: 43d2b31

Comment thread packages/server/src/server/server.ts Outdated
Comment thread packages/core-internal/src/shared/protocol.ts Outdated
Comment thread packages/core-internal/src/shared/protocol.ts Outdated
Comment thread packages/server/src/server/server.ts Outdated
Comment thread examples/server/src/serverGuide.examples.ts Outdated
@mattzcarey mattzcarey force-pushed the feat/elicitation-standard-schema branch from 01f43f4 to f732d6f Compare June 25, 2026 13:51
Comment thread packages/server/src/server/server.ts Outdated
Comment thread packages/server/src/server/server.ts Outdated
Comment thread examples/server/src/elicitationFormExample.ts Outdated

@felixweinberger felixweinberger left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM

Comment thread packages/server/src/server/server.ts Outdated
Comment thread packages/server/src/server/server.ts Outdated
Comment thread packages/core-internal/src/shared/elicitation.ts Outdated
Comment thread .changeset/standard-schema-elicitation.md
Comment thread examples/server/src/elicitationFormExample.ts Outdated
@mattzcarey mattzcarey force-pushed the feat/elicitation-standard-schema branch from 918c601 to a300f51 Compare July 1, 2026 09:18
Comment thread packages/server/src/server/server.ts Outdated
Comment thread packages/core-internal/src/shared/elicitation.ts Outdated
Comment thread packages/core-internal/src/shared/elicitation.ts Outdated
Comment thread packages/server/src/server/server.ts Outdated
@mattzcarey mattzcarey force-pushed the feat/elicitation-standard-schema branch from 7908e11 to 15e6243 Compare July 6, 2026 18:36
@mattzcarey mattzcarey force-pushed the feat/elicitation-standard-schema branch from 15e6243 to 12eb9e5 Compare July 6, 2026 19:01
@mattzcarey mattzcarey enabled auto-merge (squash) July 6, 2026 19:02

@felixweinberger felixweinberger left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly wondering if we should be updating the elicitInput API given we want people to use inputRequired for MRTR going forward.

Comment thread packages/core-internal/src/shared/protocol.ts Outdated
Comment thread packages/server/src/server/server.ts Outdated
Comment thread packages/core-internal/src/shared/inputRequired.ts Outdated
@mattzcarey mattzcarey disabled auto-merge July 7, 2026 08:32
@mattzcarey mattzcarey force-pushed the feat/elicitation-standard-schema branch from 12eb9e5 to 481c112 Compare July 7, 2026 08:55
@mattzcarey mattzcarey changed the title feat(server): accept Standard Schemas for elicitation feat(server): accept Standard Schemas in inputRequired.elicit Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Zod schema with Elicitation?

2 participants